# CascaderCheckbox 级联多选

# Attributes

字段名称 说明 类型 默认值
tree 数据源, List
defaultValue 默认选中的数据 (List)
aliasLabel label 别名 String label
aliasValue value 别名 String value
width double
stack 数据深度, 默认只展示到第三层 int 3
size checkbox 的尺寸 double 22
activeColor 选中颜色 Color Color(0xfff6f6f6)
itemPadding 每一选项的 padding EdgeInsets
onChange 回调函数 (v) {}
device-2020-08-10-110957.png

# 基础用法

import 'package:flutter/material.dart';
import 'package:millui/millui.dart';

class Cascader extends StatefulWidget {
  _Cascader createState() => new _Cascader();
}

class _Cascader extends State<Cascader> {
  _change(data) {
  	print(data);
  }
  
  
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('cascader'),
        ),
        body: Container(
          child: MillCascaderCheckbox(
            tree: tree,
            defaultValue: ['浙江', '山东'],
            aliasLabel: 'name',
            aliasValue: 'name',
            width: 326,
            onChange: _change,
          ),
        ));
  }
}

List tree = [
  {
    "id": "1000001",
    "name": "华北",
    "parentId": "100001",
    "level": "11",
    "abbr": "hb",
    "children": [
      {
        "id": "16842752",
        "name": "北京",
        "parentId": "1000001",
        "level": "12",
        "abbr": "bj",
        "children": []
      },
      {
        "id": "16908288",
        "name": "天津",
        "parentId": "1000001",
        "level": "12",
        "abbr": "tj",
        "children": []
      },
      {
        "id": "16973824",
        "name": "河北",
        "parentId": "1000001",
        "level": "12",
        "abbr": "hb",
        "children": [
          {
            "id": "16974080",
            "name": "石家庄",
            "parentId": "16973824",
            "level": "13",
            "abbr": "sjz",
            "children": []
          },
          {
            "id": "16976128",
            "name": "廊坊",
            "parentId": "16973824",
            "level": "13",
            "abbr": "lf",
            "children": []
          },
          {
            "id": "16976384",
            "name": "衡水",
            "parentId": "16973824",
            "level": "13",
            "abbr": "hs",
            "children": []
          },
          {
            "id": "16976640",
            "name": "沧州",
            "parentId": "16973824",
            "level": "13",
            "abbr": "cz",
            "children": []
          }
        ]
      },
      {
        "id": "17039360",
        "name": "山西",
        "parentId": "1000001",
        "level": "12",
        "abbr": "sx",
        "children": [
          {
            "id": "17039616",
            "name": "太原",
            "parentId": "17039360",
            "level": "13",
            "abbr": "ty",
            "children": []
          },
          {
            "id": "17039872",
            "name": "大同",
            "parentId": "17039360",
            "level": "13",
            "abbr": "dt",
            "children": []
          },
          {
            "id": "17041152",
            "name": "晋中",
            "parentId": "17039360",
            "level": "13",
            "abbr": "jz",
            "children": []
          },
          {
            "id": "17041408",
            "name": "运城",
            "parentId": "17039360",
            "level": "13",
            "abbr": "yc",
            "children": []
          },
          {
            "id": "17042176",
            "name": "吕梁",
            "parentId": "17039360",
            "level": "13",
            "abbr": "ll",
            "children": []
          }
        ]
      },
      {
        "id": "17104896",
        "name": "内蒙古",
        "parentId": "1000001",
        "level": "12",
        "abbr": "nmg",
        "children": [
          {
            "id": "17105152",
            "name": "呼和浩特",
            "parentId": "17104896",
            "level": "13",
            "abbr": "hhht",
            "children": []
          },
          {
            "id": "17105408",
            "name": "包头",
            "parentId": "17104896",
            "level": "13",
            "abbr": "bt",
            "children": []
          },
          {
            "id": "17105664",
            "name": "乌海",
            "parentId": "17104896",
            "level": "13",
            "abbr": "wh",
            "children": []
          },
          {
            "id": "17107712",
            "name": "阿拉善盟",
            "parentId": "17104896",
            "level": "13",
            "abbr": "alsm",
            "children": []
          },
          {
            "id": "17107968",
            "name": "兴安盟",
            "parentId": "17104896",
            "level": "13",
            "abbr": "xam",
            "children": []
          }
        ]
      }
    ]
  },
 ]